/**
 * 文件名：AppVersionController.java
 *
 * 创建人：虞云波 - .com
 *
 * 创建时间：2017年10月10日 下午7:38:59
 *
 * 版权所有：江苏晟邦网络科技有限公司
 */
package com.cbwl.eoas.web.controller.appint;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.cbwl.eoas.cms.api.eoas.IAppPictuerService;
import com.cbwl.eoas.cms.api.eoas.IAppVersionService;
import com.cbwl.eoas.cms.model.eoas.AppPictuerDTO;
import com.cbwl.eoas.cms.model.eoas.AppVersionDTO;
import com.cbwl.eoas.common.web.Result;
import com.cbwl.eoas.web.framework.annotation.InterceptorUrl;

/**
 * <p>[描述信息：app版本控制类]</p>
 *
 * @author 虞云波 - yuyunbo@3856.cc
 * @version 1.0 Created on 2017年10月10日 下午7:38:59
 */
@RestController
@RequestMapping("/v1/version")
public class AppVersionController {

	
	
	/**
	 * app版本Service,数据源注入
	 */
	@Autowired
	private IAppVersionService appVersionService;
	
	
	/**
	 * 
	 * <p>获取版本号</p>
	 * 
	 * @param request
	 * @param bean
	 * @return
	 * @author: 虞云波 - yuyunbo@3856.cc 
	 * @date: Created on 2017年12月4日 上午11:08:39
	 */
	@RequestMapping(value="/getVersion",method = RequestMethod.POST)
	@InterceptorUrl(validsecond=0,validnum=0)
	public Object getVersion(HttpServletRequest request,AppVersionDTO bean){
		Result result = new Result(Result.Status.OK, "请求成功", "200");
		if(StringUtils.isEmpty(bean.getVersionType())){
			result.setCode("CBWL-000010");
			return result;
		}
		bean =appVersionService.getAppVersionLatest(bean);
		bean.setTimeStamp(System.currentTimeMillis());
		result.setData(bean);
		return result;
	}
	
	
	/**
	 * 
	 * <p>app获取图片信息</p>
	 * 
	 * @param request
	 * @param bean
	 * @return
	 * @author: 虞云波 - yuyunbo@3856.cc 
	 * @date: Created on 2017年12月7日 下午2:42:28
	 */
	@RequestMapping(value="/getPic",method = RequestMethod.POST)
	public Object getPic(HttpServletRequest request,AppPictuerDTO bean){
		Result result = new Result(Result.Status.OK, "请求成功", "200");
		if(StringUtils.isEmpty(bean.getPicType())){
			result.setCode("CBWL-000010");
			return result;
		}
		List<AppPictuerDTO> list =appVersionService.queryObjectListForApp(bean);
		result.setData(list);
		return result;
	}
	
	
	
	
	
	
	
	
	
}
